package com.j256.ormlite.stmt;

import com.j256.ormlite.field.FieldType;
import com.j256.ormlite.field.SqlType;
import java.sql.SQLException;

public abstract class BaseArgumentHolder
  implements ArgumentHolder
{
  private String columnName = null;
  private FieldType fieldType = null;
  private SqlType sqlType = null;

  public BaseArgumentHolder()
  {
  }

  public BaseArgumentHolder(SqlType paramSqlType)
  {
    this.sqlType = paramSqlType;
  }

  public BaseArgumentHolder(String paramString)
  {
    this.columnName = paramString;
  }

  public String getColumnName()
  {
    return this.columnName;
  }

  public FieldType getFieldType()
  {
    return this.fieldType;
  }

  public Object getSqlArgValue()
    throws SQLException
  {
    if (!isValueSet())
      throw new SQLException("Column value has not been set for " + this.columnName);
    Object localObject = getValue();
    if (localObject == null)
      localObject = null;
    while (this.fieldType == null)
      return localObject;
    if ((this.fieldType.isForeign()) && (this.fieldType.getType() == localObject.getClass()))
      return this.fieldType.getForeignIdField().extractJavaFieldValue(localObject);
    return this.fieldType.convertJavaFieldToSqlArgValue(localObject);
  }

  public SqlType getSqlType()
  {
    return this.sqlType;
  }

  protected abstract Object getValue();

  protected abstract boolean isValueSet();

  public void setMetaInfo(FieldType paramFieldType)
  {
    if (this.fieldType == null);
    while (this.fieldType == paramFieldType)
    {
      this.fieldType = paramFieldType;
      return;
    }
    throw new IllegalArgumentException("FieldType name cannot be set twice from " + this.fieldType + " to " + paramFieldType + ".  Using a SelectArg twice in query with different columns?");
  }

  public void setMetaInfo(String paramString)
  {
    if (this.columnName == null);
    while (this.columnName.equals(paramString))
    {
      this.columnName = paramString;
      return;
    }
    throw new IllegalArgumentException("Column name cannot be set twice from " + this.columnName + " to " + paramString + ".  Using a SelectArg twice in query with different columns?");
  }

  public void setMetaInfo(String paramString, FieldType paramFieldType)
  {
    setMetaInfo(paramString);
    setMetaInfo(paramFieldType);
  }

  public abstract void setValue(Object paramObject);

  public String toString()
  {
    if (!isValueSet())
      return "[unset]";
    try
    {
      Object localObject = getSqlArgValue();
      if (localObject == null)
        return "[null]";
      String str = localObject.toString();
      return str;
    }
    catch (SQLException localSQLException)
    {
      return "[could not get value: " + localSQLException + "]";
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.j256.ormlite.stmt.BaseArgumentHolder
 * JD-Core Version:    0.6.2
 */